<html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>会议资料上报</title>
    <meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <link href="http://www.139931.com/index/css/onlinebooking.css?20141101" rel="stylesheet" type="text/css">
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
    <style>
    </style></head>

<body id="onlinebooking" class="mode_webapp">
<form action="" method="post">
   
<div class="cardexplain">
    <!--普通用户登录时显示-->
    <!--后台可控制是否显示-->
    <div class="detailcontent" id="ddsm"><h2>会议名称</h2>
        <div class="content">
            <ss id="content">
            <?=$meet->title?>    
        </ss>
        </div>
    </div>
  
    <!--粉丝填写过的信息的，直接就显示名字电话，粉丝没有填写过信息的话，这里就直接留空让粉丝填写-->
    <ul class="round" id="txbd">
        
        <li class="title mb"><span class="none">选中上传就完成上报，可以选择多张照片</span></li>      
		<li class="nob">

            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="kuang">
                <tbody><tr>
                    <th>上报图片</th>
                    <td><button id='uploadimg'>选择图片</button></td>
                </tr>
                </tbody></table>
        </li>
		<li class="nob" id='imgdiv' style='display:none;'>

            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="kuang">
                <tbody><tr>
					<th>图片预览</th>
                    <td><div id='imgpre' text-align='center'></div></td>
                </tr>
                </tbody></table>
        </li>
       
    </ul>

   
    <script type="text/javascript">
	
	$(document).ready(function () {
                var mid=<?=$meet->mid?>;
                var uid=<?=$uid?>;
                var geturl = "http://ijinan.e23.cn/index.php?m=content&c=appcontent&a=getwxSha1&url="+encodeURIComponent(window.location.href);
                $.ajax({
                    type : "get",
                    url : geturl,
                    dataType : "jsonp",
                    jsonp: "callback",
                    jsonpCallback:"success_jsonpCallback1",
                    success : function(json){
                        wx.config({
                            debug: false,
                            appId: json.wxappid,
                            timestamp: json.timestamp,
                            nonceStr: json.wxnonceStr,
                            signature: json.wxSha1,
                            jsApiList: ['chooseImage','uploadImage']
                        });
                    },
                    error:function(){
                    }
                });
			wx.ready(function(){

				$('#uploadimg').click(function()
				{
					wx.chooseImage({
					count: 4, // 默认9
					sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图，默认二者都有
					sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机，默认二者都有
					success: function (res) {
						var localIds = res.localIds; // 返回选定照片的本地ID列表，localId可以作为img标签的src属性显示图片
                        var i = 0, length = localIds.length;
                        var images=[];
                        function upload() {
                           
                            wx.uploadImage({
                                localId: localIds[i],
                                success: function (res) {
                                var serverId = res.serverId; // 返回图片的服务器端ID
                                i++;
                                
                                $.ajax({
                                    url : "http://dangjian.e23.cn/frontend/web/api/downimg",
                                    type : 'get',
                                    async: false,//使用同步的方式,true为异步方式
                                    data : {'mediaid':serverId,'mid':mid,'uid':uid},//这里使用json对象
                                    success : function(data){
                                        images[i]=data;
                                       
                                        //$('#thumb').val($('#thumb').val()+'|'+images[i]);
                                        $('#imgdiv').show();
                                    
                                        $('#imgpre').append("<img width='30%'  src='"+images[i]+"'></img>");
                                        alert('上报成功');
                                    },
                                    fail:function(){
                                    //code here...
                                    }
                                });
                                if (i < length) {
                                    upload();
                                }
                                },
                                fail: function (res) {
                                    alert(JSON.stringify(res));
                                }
                            });
                        }
						upload();

						

					}
					});
					return false;
				
				});

				

			});



	});




    </script>
</div>
</form>


</body></html>